<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>入库查询</title>
<script type="text/javascript">
    function returnBack() {
        location.href = "/stocks/stockList";
    }
    function downloadExcel() {
        var goods_sku = $("#goods_sku").val();
        var order_sku = $("#order_sku").val();
        var search_factorys = $("#search_factorys").val();
        var starttime = $("#starttime").val();
        var endtime = $("#endtime").val();
        location.href = "/stocks/ajaxbutton?op=downloadInStockExcel&goods_sku="+goods_sku+"&order_sku="+order_sku+"&search_factorys="+search_factorys+"&starttime="+starttime+"&endtime="+endtime;
    }
    function outStock() {
        var search_factorys = $("#search_factorys").val();
        var starttime = $("#starttime").val();
        location.href = "/stocks/ajaxbutton?op=outStockInfos&search_factorys="+search_factorys+"&starttime="+starttime;
    }
    function doInStockRevoke(id,savenumid) {
        $.post(
                "/stocks/ajaxbutton",
                {"op":"doInStockRevoke","id":id,"savenumid": savenumid},
                function (data){
                    if(data.code){
                        alert(data.msg);
                        location.reload();
                    }else {
                        alert(data.msg);return false;
                    }

                }, "json");
        return false;
    }
</script>
<body class="withvernav">
<div class="bodywrapper">
    {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent">
        <div class="pageheader notab">
            <h1 class="pagetitle">入库查询</h1>
            <span class="pagedesc"></span>
        </div>
        <!--pageheader-->
        <div id="contentwrapper" class="contentwrapper">
            <div id="basicform" class="subcontent">
                <!--搜索栏-->
                <div>
                    <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
                </div>
                <form class="stdform stdform2" method="get" id="search" action="/stocks/inStockSearch">
                    <div class="tableoptions">
                        ID:
                        <input type="text" name="order_sku" id="order_sku" class="width200" value="{{$order_sku}}" placeholder="请输入ID" style="width:120px;"/>
                        商品编号:
                        <input type="text" name="goods_sku" id="goods_sku" class="width200" value="{{$goods_sku}}" placeholder="请输入商品编号" style="width:120px;"/>
                        入库时间：
                        <input type="text"  name="starttime" id = "starttime" value="{{$starttime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" /> - <input type="text"  name="endtime" id = "endtime" value="{{$endtime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" />
                        工厂：
                        <select class="selectCss2" name="search_factorys" id="search_factorys" onChange="searchEmployee()">
                            <option value="">请选择</option>
                            {{foreach from=$factorys item=res key=key}}
                            <option value="{{$res.id}}" {{if $search_factorys eq {{$res.id}}}}selected{{/if}}> {{$res.name}} </option>
                            {{/foreach}}
                        </select>
                        &nbsp;
                        <a href="javascript:void();">
                            <button type="button" class="btn btn_orange btn_search radius50" onclick="returnBack()">返回库存管理</button>
                        </a>
                        <button class="btn btn_orange btn_search radius50">查询</button>
                        <a href="javascript:void();" onClick="outStockRecord()">
                            <button type="button" class="btn btn_orange btn_search radius50" onClick="outStock()">出库总览</button>
                        </a>
                        <a href="javascript:void();" onClick="downloadExcel()">
                            <button type="button" class="btn btn_orange btn_search radius50">下载excel</button>
                        </a>
                    </div>
                </form>
                <!--搜索栏结束-->
                <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
                    <thead>
                    <tr class="lbbt">
                        <td  bgcolor="#FEFFF1">商品编号</td>
                        <td  bgcolor="#FEFFF1" style="width: 130px;">订单编号</td>
                        <td  bgcolor="#FEFFF1" style="width: 130px;">商品名称</td>
                        <td  bgcolor="#FEFFF1">型号</td>
                        <td  bgcolor="#FEFFF1">入库前数量</td>
                        <td  bgcolor="#FEFFF1">入库数量</td>
                        <td  bgcolor="#FEFFF1">入库后数量</td>
                        <td  bgcolor="#FEFFF1">入库时间</td>
                        <td  bgcolor="#FEFFF1">入库人</td>
                        <td  bgcolor="#FEFFF1">描述</td>
                        <td  bgcolor="#FEFFF1">操作</td>
                    </tr>
                    </thead>
                    <tbody >
                    {{foreach from=$stocklist item=li key=key}}
                    <tr>
                        <td  bgcolor="#FEFFF1"><a href="/product/productlist?other={{{{$li.productsku}}}}">{{$li.productsku}}</a></td>
                        <td  bgcolor="#FEFFF1">{{$li.orderid}}</td>
                        <td  bgcolor="#FEFFF1">{{$li.productname}}</td>
                        <td  bgcolor="#FEFFF1">{{$li.producttypename}}</td>
                        <td  bgcolor="#FEFFF1">{{$li.oldsavenum}}</td>
                        <td  bgcolor="#FEFFF1">{{$li.insavenum}}</td>
                        <td  bgcolor="#FEFFF1">{{$li.newsavenum}}</td>
                        <td  bgcolor="#FEFFF1">{{$li.createtime}}</td>
                        <td  bgcolor="#FEFFF1">{{$li.createopername}}</td>
                        <td  bgcolor="#FEFFF1">{{$li.descr}}</td>
                        <td bgcolor="#FFFFFF" class="cz">
                            {{if $li.flag eq 1}}
                            {{else}}
                            <a href="javascript:void(0)" style="color:dodgerblue;" onclick="doInStockRevoke({{$li.id}},{{$li.savenumid}})">撤销</a>
                            {{/if}}
                        </td>
                    </tr>
                    {{/foreach}}
                    </tbody>
                </table>
                <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
            </div>
        </div>
</body>
</html>